<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="6">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span>任务总览</span>
            </div>
          </template>
          <div class="stat-content">
            <div class="stat-item">
              <div class="stat-title">总任务数</div>
              <div class="stat-number">{{ totalTasks }}</div>
            </div>
            <div class="stat-item">
              <div class="stat-title">进行中</div>
              <div class="stat-number">{{ processingTasks }}</div>
            </div>
            <div class="stat-item">
              <div class="stat-title">已完成</div>
              <div class="stat-number">{{ completedTasks }}</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span>任务趋势</span>
              <el-radio-group v-model="timeRange" size="small">
                <el-radio-button label="week">本周</el-radio-button>
                <el-radio-button label="month">本月</el-radio-button>
                <el-radio-button label="year">本年</el-radio-button>
              </el-radio-group>
            </div>
          </template>
          <div class="chart-container">
            <!-- TODO: 集成图表组件 -->
            <div class="empty-chart">图表区域</div>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="12">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span>任务类型分布</span>
            </div>
          </template>
          <div class="chart-container">
            <!-- TODO: 集成饼图组件 -->
            <div class="empty-chart">饼图区域</div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="12">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span>任务优先级分布</span>
            </div>
          </template>
          <div class="chart-container">
            <!-- TODO: 集成饼图组件 -->
            <div class="empty-chart">饼图区域</div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const timeRange = ref('week')
const totalTasks = ref(0)
const processingTasks = ref(0)
const completedTasks = ref(0)

// TODO: 从API获取统计数据
</script>

<style lang="scss" scoped>
.stat-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;

  .stat-title {
    color: #606266;
    font-size: 14px;
    margin-bottom: 10px;
  }

  .stat-number {
    color: #303133;
    font-size: 24px;
    font-weight: bold;
  }
}

.chart-container {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-chart {
  color: #909399;
  font-size: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>